for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import { HttpService } from '@nestjs/axios';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { IMattermostNotifier } from 'src/Application/IMattermostNotifier';
@Injectable()
export class MattermostNotifier implements IMattermostNotifier {
constructor(
private readonly configService: ConfigService,
private readonly httpService: HttpService
) {}
public async createPost(channelId: string, message: string): Promise<object> {
try {
const response = await this.httpService.axiosRef.post(
`${this.configService.get<string>('MATTERMOST_API_URL')}/posts`,
{
channel_id: channelId,
message
},
headers: {
Authorization: `Bearer ${this.configService.get<string>(
'MATTERMOST_ALFRED_TOKEN'
)}`
}
);
return response.data;
} catch (e) {
console.log('ERROR: ', e);
public async createComment(
channelId: string,
message: string,
rootId: string
): Promise<object> {
return {};
public async createReaction(
postId: string,
emojiName: string
// try {
// const response = await this.httpService.axiosRef.post(
// `${this.configService.get<string>('MATTERMOST_API_URL')}/reactions`,
// {
// channel_id: channelId,
// message
// },
// headers: {
// Authorization: `Bearer ${this.configService.get<string>(
// 'MATTERMOST_ALFRED_TOKEN'
// )}`
// }
// );
// return response.data;
// } catch (e) {
// console.log('ERROR: ', e);